package org.wisdom.ac.apis;

import org.springframework.web.bind.annotation.*;
import org.wisdom.ac.dto.AuthUserDto;
import org.wisdom.ac.dto.UserDto;
import org.wisdom.annotation.WisdomFeignClient;
import org.wisdom.vo.PageModel;
import org.wisdom.vo.ResponseResult;

/**
 * 系统用户API
 *
 * @author 张智研
 * @date 2022/05/27 10:13
 **/
@WisdomFeignClient(name = "${wisdom.ac.name:wisdom-ac}", path = "/${wisdom.ac.name:wisdom-ac}/user", contextId = "wisdom-ac-user")
public interface UserController {

    /**
     * 获取当前登陆用户信息
     *
     * @author 张智研
     * @date 2022/09/04 14:52
     * @return org.wisdom.vo.ResponseResult<UserDto>
     */
    @GetMapping(value = "/get_info")
    ResponseResult<UserDto> getInfo();

    /**
     * 创建用户
     *
     * @author 张智研
     * @date 2022/05/30 15:19
     * @param userDto
     *            用户信息
     * @return org.wisdom.vo.ResponseResult<java.lang.String>
     */
    @PostMapping
    ResponseResult<String> save(@RequestBody UserDto userDto);

    /**
     * 读取用户
     *
     * @author 张智研
     * @date 2022/05/30 15:20
     * @param userId
     *            用户id
     * @return org.wisdom.vo.ResponseResult<org.wisdom.ac.dto.UserDto>
     */
    @GetMapping("/{userId}")
    ResponseResult<UserDto> get(@PathVariable("userId") String userId);

    /**
     * 删除用户
     * 
     * @author 张智研
     * @date 2022/05/30 15:21
     * @param userIds
     *            用户id
     * @return org.wisdom.vo.ResponseResult<java.lang.String>
     */
    @DeleteMapping("/{userIds}")
    ResponseResult<String> delete(@PathVariable("userIds") String userIds);

    /**
     * 查询用户列表
     * 
     * @author 张智研
     * @date 2022/05/30 15:25
     * @param userDto
     *            查询条件
     * @return org.wisdom.vo.ResponseResult<org.wisdom.vo.PageModel<org.wisdom.ac.dto.UserDto>>
     */
    @GetMapping("/list")
    ResponseResult<PageModel<UserDto>> list(UserDto userDto);

    /**
     * 修改用户密码
     *
     * @author 张智研
     * @date 2023/04/19 11:24
     * @param userDto 用户
     * @return org.wisdom.vo.ResponseResult<java.lang.String>
     */
    @PutMapping("/resetPwd")
    ResponseResult<String> resetPwd(@RequestBody UserDto userDto);


    /**
     * 查询指定角色的关联用户列表
     *
     * @author 张智研
     * @date 2022/05/30 15:25
     * @param userDto 查询条件
     * @return org.wisdom.vo.ResponseResult<org.wisdom.vo.PageModel<org.wisdom.ac.dto.UserDto>>
     */
    @GetMapping("/allocatedList")
    ResponseResult<PageModel<UserDto>> allocatedList(UserDto userDto);

    /**
     * 查询指定角色的非关联用户列表
     *
     * @author 张智研
     * @date 2023/05/17 13:15
     * @param userDto 查询条件
     * @return org.wisdom.vo.ResponseResult<org.wisdom.vo.PageModel<org.wisdom.ac.dto.UserDto>>
     */
    @GetMapping("/unallocatedList")
    ResponseResult<PageModel<UserDto>> unallocatedList(UserDto userDto);

    /**
     * 授权用户
     *
     * @author 张智研
     * @date 2023/05/17 13:53
     * @param authUserDto 授权用户信息
     * @return org.wisdom.vo.ResponseResult<java.lang.String>
     */
    @PostMapping("/authUser")
    ResponseResult<String> authUser(@RequestBody AuthUserDto authUserDto);

    /**
     * 取消授权用户
     *
     * @author 张智研
     * @date 2023/05/17 21:50
     * @param authUserDto 授权用户信息
     * @return org.wisdom.vo.ResponseResult<java.lang.String>
     */
    @PostMapping("/authUserCancel")
    ResponseResult<String> authUserCancel(@RequestBody AuthUserDto authUserDto);

    /**
     * 修改用户密码
     *
     * @author 张智研
     * @date 2023/05/19 17:07
     * @param userDto 信息
     * @return org.wisdom.vo.ResponseResult<java.lang.String>
     */
    @PostMapping("/profile/updatePwd")
    ResponseResult<String> updateUserPwd(@RequestBody UserDto userDto);
}
